var ToolLayer = cc.Layer.extend({
	scene:null,
	ctor:function (parent) {
		this._super();
		this.scene = parent;
		this.scene.addChild(this, 20);
		this.init();
	},
	init: function (){
		this.lib = new cc.MenuItemImage("#button/lib1.png","#button/lib2.png",this.callback,this);
		this.menu = new cc.Menu();
		this.addChild(this.menu, 11,TAG_BUTTON_MENU);
		this.menu.setPosition(cc.p(0,0));
		this.menu.addChild(this.lib, 3, TAG_BUTTON_LIB);
		this.lib.setPosition(gg.width - this.lib.width * 0.5 - 10, gg.height -218);
	},
	callback: function(pSender) {
		switch (pSender.getTag()){
			case TAG_BUTTON_LIB:
				if(ll.tip.tip_frame.isOpen()){
					ll.tip.tipItem.setNormalSpriteFrame("#button/tip1.png");
					ll.tip.tipItem.setSelectedSpriteFrame("#button/tip1.png");
					ll.tip.tip_frame.close()
					gg.synch_l = false;
				}
				if(ll.run.lib.isOpen()){
					this.lib.setNormalSpriteFrame("#button/lib1.png");
					this.lib.setSelectedSpriteFrame("#button/lib1.png");
					ll.run.lib.close();
				} else {					
					this.lib.setNormalSpriteFrame("#button/lib2.png");
					this.lib.setSelectedSpriteFrame("#button/lib2.png");
					ll.run.lib.open();	
					if(gg.flow.flow.tag[1]==TAG_BUTTON_LIB){						
						pSender.runAction(cc.sequence(cc.delayTime(0.5),cc.callFunc(function() {
							gg.flow.next();
						}, this)));
					}
				}
				break;
		}
	}
})